package com.jython.demo;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;

public class Mani {
    public static SqlSession sqlSession=null;
    public static SqlSessionFactory sqlSessionFactory=null;
    static {
        ClassLoader classloader = Thread.currentThread().getContextClassLoader();
        InputStream is= classloader.getResourceAsStream("SqlMapConfig.xml");
        sqlSessionFactory = new SqlSessionFactoryBuilder().build(is);
        sqlSession = sqlSessionFactory.openSession();
    }
    public static void main(String[] args) {
        t2();
    }
    public static void t2(){
        Object o = sqlSession.selectOne("WordCountMapper.selectByPrimaryKey", 2);
        System.out.println("this is main");
        System.out.println(o);
        sqlSession.close();
    }
}
